package wang.suanfang;

import java.util.ArrayList;

public class search {
    public static void main(String[] args) {
        int[] arr = {122, 55, 142, 78, 33, 56, 45, 78};
        int number = 78;


        ArrayList<Integer> search1 = search(arr, number);
        System.out.println(search1);

    }

    private static void bianli(int[] search) {
        for (int i = 0; i < search.length; i++) {
            System.out.print(search[i] + " ");
        }
    }

    private static ArrayList<Integer> search(int[] arr, int number) {
        // int[] arr1=new int[10];
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == number) {
                list.add(i);
            }
        }

        return list;
    }
}
